package com.springboot.controller;

import com.springboot.entity.GoodsInfo;
import com.springboot.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/test")
public class StockController {
    @Autowired
    private TestService testService;

    @GetMapping("/select-all")
    public List<GoodsInfo> getAll() {
        List<GoodsInfo> goodsInfos = testService.selectAll();
        goodsInfos.forEach(e-> System.out.println(e.toString()));
        return goodsInfos;
    }

    @GetMapping("/save")
    public int save(){
        return testService.save();
    }
}
